using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.HJT212DB
{
    public class PointCommuMap : EntityTypeConfiguration<PointCommu>
    {
        public PointCommuMap()
        {
            // Primary Key
            this.HasKey(t => new { t.P_ID, t.CommuTypeID });

            // Properties
            this.Property(t => t.P_ID)
                .IsRequired()
                .HasMaxLength(36);

            this.Property(t => t.CommuTypeID)
                .IsRequired()
                .HasMaxLength(2);

            this.Property(t => t.PhotoNumber)
                .HasMaxLength(20);

            this.Property(t => t.ApparatusID)
                .IsRequired()
                .HasMaxLength(14);

            this.Property(t => t.UserID)
                .HasMaxLength(20);

            this.Property(t => t.UserPassWord)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("PointCommu");
            this.Property(t => t.P_ID).HasColumnName("P_ID");
            this.Property(t => t.CommuTypeID).HasColumnName("CommuTypeID");
            this.Property(t => t.CommuOrder).HasColumnName("CommuOrder");
            this.Property(t => t.PhotoNumber).HasColumnName("PhotoNumber");
            this.Property(t => t.ApparatusID).HasColumnName("ApparatusID");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.UserPassWord).HasColumnName("UserPassWord");
        }
    }
}
